﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    CodeFile="GetFlightList.aspx.cs" Inherits="Admin_GetFlightList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <strong><span style="font-size: 16pt">Flight List</span></strong><br />
    <br />
    <div align="center">
        <table align="center" cellpadding="3" cellspacing="3" style="width: 100%">
            <tr>
                <td>
                </td>
                <td align="center">
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/AddFlight.aspx">Add Flight</asp:HyperLink>
                </td>
                <td>
                    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Admin/PriceFlightList.aspx">Price Manager</asp:HyperLink>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:HyperLink ID="HyperLink3" runat="server" 
                        NavigateUrl="~/Admin/CancelFlight.aspx">Cancel Flight</asp:HyperLink>
                </td>
                <td>
                    <asp:HyperLink ID="HyperLink4" runat="server" Text="Add Price" 
                        NavigateUrl="~/Admin/AddPriceFlight.aspx"></asp:HyperLink>
                </td>
                <td>
                    &nbsp;
                </td>
        </table>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:sqlString %>"
            SelectCommand="SELECT Airline_Flight.FlightID, Airline_Flight.[Depart Time], Airline_Flight.[Avail Bussiness Seat], Airline_Flight.[Avail First Seat], Airline_Flight.[Avail Club Seat], Airline_Flight.FlightStatus, Airline_Flight.isAllowSmoking, Airline_Airplane.[Plane Name], Airline_Route.FlyHour, CAST(Airline_Cities.[City Name] AS varchar(50)) + ', ' + CAST(Airline_Cities.State AS varchar(50)) + ', ' + CAST(Airline_Cities.Country AS varchar(50)) AS [FROM], CAST(Airline_Cities_1.[City Name] AS varchar(50)) + ', ' + CAST(Airline_Cities_1.State AS varchar(50)) + ', ' + CAST(Airline_Cities_1.Country AS varchar(50)) AS [TO], Airline_Cities.GMT FROM Airline_Route INNER JOIN Airline_Cities ON Airline_Route.OriginalCityID = Airline_Cities.CityID INNER JOIN Airline_Schedule ON Airline_Route.RouteID = Airline_Schedule.RouteID INNER JOIN Airline_Flight INNER JOIN Airline_Airplane ON Airline_Flight.AirPlaneID = Airline_Airplane.AirPlaneID ON Airline_Schedule.SchedueID = Airline_Flight.ScheduleID INNER JOIN Airline_Cities AS Airline_Cities_1 ON Airline_Route.DestinationCityID = Airline_Cities_1.CityID">
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="FlightID"
            DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
            BackColor="White" BorderColor="White" BorderStyle="Ridge" 
            BorderWidth="2px" CellPadding="3"
            CellSpacing="1" GridLines="None" AllowPaging="True" AllowSorting="True" 
            PageSize="8">
            <Columns>
                <asp:BoundField DataField="FlightID" HeaderText="Flight ID" InsertVisible="False"
                    ReadOnly="True" SortExpression="FlightID">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="FROM" HeaderText="FROM" ReadOnly="True" SortExpression="FROM">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:BoundField>
                <asp:BoundField DataField="TO" HeaderText="TO" ReadOnly="True" SortExpression="TO">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:BoundField>
                <asp:BoundField DataField="Plane Name" HeaderText="Airplane" SortExpression="Plane Name">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="Depart Time" HeaderText="Depart Time" SortExpression="Depart Time"
                    DataFormatString="{0:t} {0:D}">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:BoundField>
                <asp:BoundField DataField="GMT" DataFormatString="GMT {0}" SortExpression="GMT">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="FlyHour" HeaderText="Fly Hour" SortExpression="FlyHour"
                    DataFormatString="{0} hour(s)">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Avail Bussiness Seat" HeaderText="Avail Buss Seat" SortExpression="Avail Bussiness Seat">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Avail First Seat" HeaderText="Avail First Seat" SortExpression="Avail First Seat">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Avail Club Seat" HeaderText="Avail Club Seat" SortExpression="Avail Club Seat">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="FlightStatus" HeaderText="Flight Status" SortExpression="Flight Status">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:BoundField>
                <asp:CheckBoxField DataField="isAllowSmoking" HeaderText="Smoking" SortExpression="isAllowSmoking">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </asp:CheckBoxField>
            </Columns>
            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
            <EmptyDataTemplate>
                No FLight
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
        </asp:GridView>
        <br />
        <br />
    </div>
</asp:Content>
